package cn.zjxiliu.lib_core.db;

import android.support.annotation.NonNull;

import com.orhanobut.logger.Logger;

import org.litepal.LitePal;
import org.litepal.LitePalDB;

/**
 * Created by jessie on 2018/10/25.
 */

public class DataBaseHelper {


    private static final String TAG = "DataBaseHelper";

    private static final DataBaseHelper databaseHelper;

    static {
        databaseHelper = new DataBaseHelper();
    }

    public static DataBaseHelper getInstance(){
        return databaseHelper;
    }

    /**
     * 使用相应数据库by数据库名称
     * @param dbName
     */
    public void useByName(@NonNull String dbName){
        Logger.i(TAG, "useByName >>>" + dbName);
        LitePalDB litePalDB = LitePalDB.fromDefault(dbName);
        LitePal.use(litePalDB);
    }

    public void userByCustom(LitePalDB litePalDB){
        LitePal.use(litePalDB);
    }


}
